//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
//==========================================================================
// Copyright (c) 2000-2004,  Elastos, Inc.  All Rights Reserved.
//**author:hanxu
//**y/m/d:2005/5/16
//==========================================================================

#ifndef __ELASTOS_FW82371_H__
#define __ELASTOS_FW82371_H__

#define SB_IRQS 16

struct FW82371IsrDescriptors
{
    isr_t   Isr;        // Interrupt service routine for IRQn
    void    *pDevice;   // Argument to pass to it
};

#define outb(val,port)\
do {\
*(volatile unsigned char *)(0xbfd00000 + (port)) = (val);  \
} while(0)

static inline unsigned char inb(unsigned long port)
{
    return (*(volatile unsigned char *)(0xbfd00000 + port));
}

EXTERN IDeviceDriver * CDECL InitFW82371IRQ(uint_t uDeviceNo, void *pvParameter);
void FW82371DispatchIsr(irq_t cIrq, void *pvDevice,
    InterruptContext *pContext);
bool MaskAndAck8259A(irq_t cIrq, void *pvDevice, InterruptContext *pContext);
void DisableFW82371Irq(unsigned int irq_nr);
void EnableFW82371Irq(unsigned int irq_nr);
void AddFW82371Device(unsigned int uIrq, isr_t Isr, void *pDevice);

#endif // __ELASTOS_FW82371_H__
